﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace DbProfiler.DatabaseAccess
{
    public abstract class ConnectionFactory
    {
        public static IDbConnection GetConnection(DatabaseType databaseType, string connectionString)
        {
            switch (databaseType)
            {
                case DatabaseType.MsftSqlServer2005:
                    return (IDbConnection)new System.Data.SqlClient.SqlConnection(connectionString);

                case DatabaseType.MsftSqlServer2000:
                    return (IDbConnection)new System.Data.SqlClient.SqlConnection(connectionString);

                case DatabaseType.ODBC:
                    return (IDbConnection)new System.Data.Odbc.OdbcConnection(connectionString);

                case DatabaseType.Oracle:
                    return (IDbConnection)new System.Data.OracleClient.OracleConnection(connectionString);

                default:
                    throw new NotImplementedException("The database type '" + databaseType.ToString() + "' is not yet supported!");
            }
        }
    }
}
